#include "renrenwidget.h"
#include "ui_renrenwidget.h"

#include <QtWebKit>

RenrenWidget::RenrenWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::RenrenWidget)
{
    ui->setupUi(this);
    this->dealRenrenEvent = new Dealrenrenevent(this->prenrenAccount);
    this->pEmotionApi = new EmotionApi();
    this->pFeedApi = new FeedApi;
    this->pGetFriendsApi = new GetFriendsApi;
    this->pStatusApi = new StatusApi();
    this->pUserApi = new UserApi();
    this->pBlogApi = new BlogApi();
    this->pPhotoApi = new PhotoApi();
    this->pShareApi = new ShareApi();

    this->pStatusWidget = NULL;

    ui->webView_left->setHtml("<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\"></body>");
    ui->webView_right->setHtml("<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\"></body>");

    connect(this->dealRenrenEvent,SIGNAL(getShareInfoSignal(QString)),this,SLOT(ReadFeed(QString)));

    QString basicHtml;
    QFile basicHtmlFile(":/other/res/renren/RenrenPage.html");
    if(!basicHtmlFile.open(QFile::ReadOnly))
    {
        qDebug("open Error!!!");
        qDebug(basicHtmlFile.errorString().toAscii());
    }
    QTextStream stream(&basicHtmlFile);
    basicHtml = stream.readAll();
    basicHtmlFile.close();

    QObject::connect( ui->webView_left->page()->mainFrame(),
                      SIGNAL(javaScriptWindowObjectCleared()),
                      this,
                      SLOT(addJavaScriptObject())
                      );

    QObject::connect( ui->webView_right->page()->mainFrame(),
                      SIGNAL(javaScriptWindowObjectCleared()),
                      this,
                      SLOT(addJavaScriptObject())
                      );


    QObject::connect(this->dealRenrenEvent,SIGNAL(createStatusWidgetSignal(QString,QString,QString,QString,int)),
                     this,SLOT(createStatusWidgetSlot(QString,QString,QString,QString,int)));
    QObject::connect(this->dealRenrenEvent,SIGNAL(forwardToOtherClientSignal(QString)),
                     this,SLOT(forwardToOtherClientSlot(QString)));

}

RenrenWidget::~RenrenWidget()
{
    delete ui;
}

void RenrenWidget::addJavaScriptObject()
{
    ui->webView_left->page()->mainFrame()->addToJavaScriptWindowObject("dealRenrenEvent",this->dealRenrenEvent);
    ui->webView_right->page()->mainFrame()->addToJavaScriptWindowObject("dealRenrenEvent",this->dealRenrenEvent);
}

void RenrenWidget::getFeed()
{

    QUrl url = this->pUserApi->getUserInfo(this->pUserApi->account.getUid()).headurl;
    httpGet.initPixMap(url);
    pFeedApi->getFeed();
    this->currentSelected = 1;
    changeSelectedPixmap(1,1);

    QString html = "<script type=\"text/javascript\" src=\"qrc:/other/res/renren/signal.js\"></script>";
    html += "<link rel=\"stylesheet\" href=\"qrc:/other/res/renren/RenrenPage.css\" type=\"text/css\"/>";
    html +="<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\">";


    for(uint i = 0; i < pFeedApi->vFeedInfo.size(); i++)
    {

        html += "<table style=\"width:100%;\">";
        html += "<tr>";
        html += "<td  valign=\"top\" style=\"width:50px;padding:5px;\" onclick=\"getShareInfo("+pFeedApi->vFeedInfo.at(i).post_id+")\">"
                "<div style=\"float:top;\"><img src=" + pFeedApi->vFeedInfo.at(i).headurl + "></image></div>"
                +"</td>";

        html +="<td valign=\"top\" style=\"padding:5px; width:350px;\" onclick=\"getShareInfo("+pFeedApi->vFeedInfo.at(i).post_id+")\">"
                +pFeedApi->vFeedInfo.at(i).name + " " + pFeedApi->vFeedInfo.at(i).prefix + " "
                "<a>"+pFeedApi->vFeedInfo.at(i).message+"</a>"
                "<a >"+pFeedApi->vFeedInfo.at(i).title +"</a>"
                "<a>"+ pFeedApi->vFeedInfo.at(i).description +"</a>";
        uint min = (pFeedApi->vFeedInfo.at(i).vfeed_media.size() > 2) ? 2 : pFeedApi->vFeedInfo.at(i).vfeed_media.size();

        for(uint j = 0; j < min; j++)
        {
            if(j==0)
                html += "<div ><img  src=" + pFeedApi->vFeedInfo.at(i).vfeed_media.at(j).src + "></image></div>";
            else
                html += "<div><img  src=" + pFeedApi->vFeedInfo.at(i).vfeed_media.at(j).src + "></image></div>";
        }
        html += "</td>";

        html += "<td style=\"float:top;\">";

        if(pFeedApi->vFeedInfo.at(i).feed_type == "10")
        {
            html += "<a class=\"btn blue\" onclick=createStatusWidget("+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",\"\""+",2)>回复</a>";
            html += "<a class=\"btn blue\" onclick=createStatusWidget("+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",\"\""+",1)>转发</a>";
            html += "<a class=\"btn blue\" onclick=\"forwardToOtherClient('"+pEmotionApi->RemoveEmotion(pFeedApi->vFeedInfo.at(i).message)+"')\">plus</a>";
        }
        if(pFeedApi->vFeedInfo.at(i).feed_type == "20")
        {
            html += "<a class=\"btn blue\" onclick=createStatusWidget("+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",\"\""+",3)>评论</a>";
            html += "<a class=\"btn blue\" onclick=createStatusWidget(1,"+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",6)>分享</a>";
        }
        if(pFeedApi->vFeedInfo.at(i).feed_type == "21")
        {
            html += "<a class=\"btn blue\" onclick=createStatusWidget("+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",\"\""+",4)>评论</a>";
            html += "<a class=\"btn blue\" onclick=createStatusWidget(20,"+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",6)>分享</a>";
        }
        if(pFeedApi->vFeedInfo.at(i).feed_type == "30")
        {
            html += "<a class=\"btn blue\" onclick=createStatusWidget(\"\"," +pFeedApi->vFeedInfo.at(i).vfeed_media.at(0).media_id+","+pFeedApi->vFeedInfo.at(i).vfeed_media.at(0).owner_id +","+"\"\""+",5)>评论</a>";
            html += "<a class=\"btn blue\" onclick=createStatusWidget(2,"+pFeedApi->vFeedInfo.at(i).vfeed_media.at(0).media_id+","+pFeedApi->vFeedInfo.at(i).vfeed_media.at(0).owner_id +","+"\"\""+",6)>分享</a>";
        }
        if(pFeedApi->vFeedInfo.at(i).feed_type == "32")
        {
            html += "<a class=\"btn blue\" onclick=createStatusWidget("+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",\"\""+",4)>评论</a>";
            html += "<a class=\"btn blue\" onclick=createStatusWidget(20,"+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",6)>分享</a>";
        }
        if(pFeedApi->vFeedInfo.at(i).feed_type == "33")
        {
            html += "<a class=\"btn blue\" onclick=createStatusWidget("+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",\"\""+",4)>评论</a>";
            html += "<a class=\"btn blue\" onclick=createStatusWidget(20,"+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",6)>分享</a>";
        }
        if(pFeedApi->vFeedInfo.at(i).feed_type == "50")
        {
            html += "<a class=\"btn blue\" onclick=createStatusWidget("+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",\"\""+",4)>评论</a>";
            html += "<a class=\"btn blue\" onclick=createStatusWidget(20,"+pFeedApi->vFeedInfo.at(i).source_id+","+pFeedApi->vFeedInfo.at(i).actor_id +","+"\"\""+",6)>分享</a>";
        }

        html += "</td>";
        html += "</tr>";
        html +="</table>";
    }
    html +="</body>";
    html = this->pEmotionApi->TextHandler(html);
    //qDebug("htmlOutput\n"+html.toLocal8Bit());
    this->ui->webView_left->setHtml(html);

}

void RenrenWidget::getFriends()
{
    pGetFriendsApi->getFriendsFromAccount();
}


void RenrenWidget::SetFriendPage()
{
    QString html= "<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\">";
    for(uint i = 0; i < pGetFriendsApi->vFriends.size(); i++)
    {
        html+="<div style=\"float:left;width:100%;height:65px;overflow:hidden;\">"
                "<div style=\"float:left;\"><img src=" + pGetFriendsApi->vFriends.at(i).tinyurl + " width=\"50\"  height=\"50\"></img></div>"
                "<div>"+ pGetFriendsApi->vFriends.at(i).name + "</div>"
                "<div>"+ pStatusApi->GetFirstStatusFromId(pGetFriendsApi->vFriends.at(i).id) + "</div>"
                   "</div>";
    }
    html +="</body>";
    html = this->pEmotionApi->TextHandler(html);
    this->ui->webView_left->setHtml(html);
}

void RenrenWidget::receiveSignalFromMainWidget(int index)
{
    if (index != 3)
    {
        changeSelectedPixmap(this->currentSelected,0);
    }
    switch(index)
    {
    case 1:
        this->getFeed();
        changeSelectedPixmap(index,1);
        this->currentSelected = index;
        break;
    case 2:
        this->SetFriendPage();
        changeSelectedPixmap(index,1);
        this->currentSelected = index;
        break;
    case 3:
        createStatusWidgetSlot("","","","",0);
        break;
    }
}

void RenrenWidget::ReadFeed(QString post_id)
{
    vector <FeedInfo> ::iterator   it;
    for(it = pFeedApi->vFeedInfo.begin(); it != pFeedApi->vFeedInfo.end(); )
    {
        if( it->post_id == post_id)
        {
            int itype = it->feed_type.toInt();
            switch(itype)
            {
            case 10:
                this->ReadStatusFeed(it->source_id,it->actor_id);
                break;
            case 20:
                this->ReadBlogFeed(it->source_id,it->actor_id);
                break;
            case 21:
                this->ReadBlogShareFeed(it->vfeed_media.at(0).media_id,it->vfeed_media.at(0).owner_id,it->actor_id);
                break;
            case 30:
                this->ReadPhotoUploadFeed(it->vfeed_media);
                break;
            case 32:
                this->ReadPhotoShareFeed(it->vfeed_media);
                break;
            case 33:
                this->ReadPhotoAlbumShareFeed(it->vfeed_media.at(0).media_id,it->vfeed_media.at(0).owner_id);
                break;
            }
            break;
        }
        else it++;
    }
}

void RenrenWidget::ReadStatusFeed(QString status_id, QString owner_id)
{
    StatusInfo statusinfo = this->pStatusApi->GetSingleStatus(status_id ,owner_id);
    vector<CommentInfo> vComments = this->pStatusApi->GetCommentsFromStatusId(status_id,owner_id);
    UserInfo userinfo =this->pUserApi->getUserInfo(owner_id);
    QString html = "<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\"><link rel=\"stylesheet\" href=\"qrc:/other/res/renren/RenrenPage.css\" type=\"text/css\"/>";

    html += "<script type=\"text/javascript\" src=\"qrc:/other/res/renren/signal.js\"></script>";

    html +="<table style=\"width:100%;\">";
    html += "<tr>";
    html += "<td  valign=\"top\" style=\"width:50px;padding:5px;\"><img src=" + userinfo.tinyurl + " width=\"50\"  height=\"50\"></img></td>";
    html += "<td valign=\"top\" style=\"padding:5px; width:400px;\"><div>"+ userinfo.name + "</div>"
            "<div>"+ statusinfo.message + "</div>"
               "</td>";
    html += "<td><a class=\"btn blue\"  onclick=createStatusWidget("+status_id+","+owner_id+","+"\"\""+",\"\""+",2)>回复</a></td>";
    html +="</tr></table>";
    for(uint i = 0; i < vComments.size(); i++)
    {
        html +="<table style=\"width:100%;\">";
        html += "<tr>";
        html += "<td  valign=\"top\" style=\"width:50px;padding:5px;\"><img src=" + vComments.at(i).tinyurl + " width=\"50\"  height=\"50\"></img></td>";
        html += "<td valign=\"top\" style=\"padding:5px; width:400px;\"><div>"+ vComments.at(i).name + "</div>"
                "<div>"+ vComments.at(i).text + "</div>"
                   "</td>";
        html += "<td><a class=\"btn blue\"  onclick=createStatusWidget("+status_id+","+owner_id+","+vComments.at(i).uid+",\"\""+",2)>回复</a></td>";
        html +="</tr></table>";
    }
    //qDebug(html.toAscii());
    html = this->pEmotionApi->TextHandler(html);
    html +="</body>";
    this->ui->webView_right->setHtml(html);
}



void RenrenWidget::setCookie(QNetworkRequest &request)
{
    QMap<QString,QString> param;
    param.insert("expires",this->pFeedApi->account.getExpires());
    param.insert("session_key",this->pFeedApi->account.getSessionKey());
    param.insert("ss",this->pFeedApi->account.getSessionSecret());
    param.insert("user",this->pFeedApi->account.getUid());

    QString sig = Utility::getSignature(param);

    QString header = Config::APIKey + "_expires=" +this->pFeedApi->account.getExpires()+
                               Config::APIKey + "_session_key=" +this->pFeedApi->account.getSessionKey()+
                               Config::APIKey + "_ss=" +this->pFeedApi->account.getSessionSecret()+
                               Config::APIKey + "_user=" +this->pFeedApi->account.getUid()+
                               Config::APIKey +"="+sig;
    request.setRawHeader("cookie",header.toAscii());
}

void RenrenWidget::createStatusWidgetSlot(QString arg_1, QString arg_2,QString arg_3,QString arg_4,int widgetType)
{
    if (pStatusWidget == NULL)
    {
        pStatusWidget = new RenrenStatusWidget(this->prenrenAccount,arg_1,arg_2,widgetType);
        QObject::connect(pStatusWidget,SIGNAL(sendStatus(QString,QString,QString,QString,QString,int)),
                         this,SLOT(StatusSlot(QString,QString,QString,QString,QString,int)));
    }

    if (widgetType == 1)
    {
        pStatusWidget->setForward_id(arg_1);
        pStatusWidget->setForward_owner(arg_2);
    }
    else if (widgetType ==2)
    {
        pStatusWidget->setStatus_id(arg_1);
        pStatusWidget->setOwner_id(arg_2);
        pStatusWidget->setReply_id(arg_3);
    }
    else if (widgetType == 3)
    {
        pStatusWidget->setLog_id(arg_1);
        pStatusWidget->setOwner_id(arg_2);
        pStatusWidget->setReply_id(arg_3);
    }

    else if (widgetType == 4)
    {
        pStatusWidget->setShare_id(arg_1);
        pStatusWidget->setOwner_id(arg_2);
        pStatusWidget->setToUser_id(arg_3);
    }
    else if (widgetType == 5)
    {
        pStatusWidget->setAlbum_id(arg_1);
        pStatusWidget->setPhoto_id(arg_2);
        pStatusWidget->setOwner_id(arg_3);
        pStatusWidget->setReply_id(arg_4);
    }
    else if (widgetType == 6)
    {
        pStatusWidget->setShare_Type(arg_1);
        pStatusWidget->setUgc_id(arg_2);
        pStatusWidget->setOwner_id(arg_3);
        pStatusWidget->setShare_Url(arg_4);
    }

    pStatusWidget->setWidgetType(widgetType);
    pStatusWidget->clearContent();

    pStatusWidget->show();

}

void RenrenWidget::StatusSlot(QString content,QString arg_1, QString arg_2, QString arg_3,QString arg_4,int widgetType)
{
    qDebug(content.toLocal8Bit());
    qDebug(arg_1.toLocal8Bit());
    qDebug(arg_2.toLocal8Bit());
    qDebug(arg_3.toLocal8Bit());
    qDebug(arg_4.toLocal8Bit());
    qDebug(QString::number(widgetType).toLocal8Bit());
    if (widgetType == 0) //新状态
    {
        this->pStatusApi->StatusUpdate(content,"","");
    }
    else if (widgetType == 1)//转发状态
    {
        this->pStatusApi->StatusUpdate(content,arg_1,arg_2);
    }
    else if (widgetType == 2)//评论状态及状态回复
    {
        this->pStatusApi->StatusAddComment(arg_1,arg_2,content,arg_3);
    }
    else if (widgetType == 3)//评论日志
    {
        this->pBlogApi->AddComment(content,arg_1,arg_2,arg_3);
    }
    else if (widgetType == 4)//评论分享
    {
        this->pShareApi->AddComment(content,arg_1,arg_2,arg_3);
    }
    else if (widgetType == 5)//评论照片
    {
        this->pPhotoApi->AddComment(content,arg_1,arg_2,arg_3,arg_4);

    }
    else if (widgetType == 6)
    {
        this->pShareApi->Share(content,arg_1,arg_2,arg_3,arg_4);
    }

}

void RenrenWidget::ReadBlogFeed(QString id, QString uid)
{
    BlogInfo bloginfo = this->pBlogApi->GetBlogFromId(id,uid);
    UserInfo userinfo =this->pUserApi->getUserInfo(uid);
    QString html="<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\">";

    html+="<div style=\"float:left;width:100%;height:55px;overflow:hidden;\">"
            "<div style=\"float:left;\"><img src=" + userinfo.tinyurl + " width=\"50\"  height=\"50\"></img></div>"
            "<div>"+ userinfo.name + "</div>"
            "<div>"+ bloginfo.title + "</div>"
               "</div>"+ bloginfo.content ;
    html = this->pEmotionApi->TextHandler(html);
    html +="</body>";
    this->ui->webView_right->setHtml(html);
}

void RenrenWidget::ReadBlogShareFeed(QString id ,QString uid,QString actor_id)
{
    BlogInfo bloginfo = this->pBlogApi->GetBlogFromId(id,uid);
    UserInfo userinfo =this->pUserApi->getUserInfo(actor_id);
    QString html="<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\">";

    html+="<div style=\"float:left;width:100%;height:55px;overflow:hidden;\">"
            "<div style=\"float:left;\"><img src=" + userinfo.tinyurl + " width=\"50\"  height=\"50\"></img></div>"
            "<div>"+ userinfo.name + "</div>"
            "<div>"+ bloginfo.title + "</div>"
               "</div>"+ bloginfo.content ;
    html = this->pEmotionApi->TextHandler(html);
    html +="</body>";
    this->ui->webView_right->setHtml(html);
}

void RenrenWidget::ReadPhotoUploadFeed(vector<Feed_media> vfeed_media)
{
    QString html="<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\">";
    QString id = vfeed_media.at(0).media_id;
    QString uid = vfeed_media.at(0).owner_id;
    UserInfo userinfo =this->pUserApi->getUserInfo(uid);
    vector<PhotoInfo> vPhotoinfo = this->pPhotoApi->GetPhotosFromId(id,uid);
    html +="<div><img src=" + userinfo.tinyurl + " width=\"50\"  height=\"50\"></img>"+ userinfo.name + ":"+vPhotoinfo.at(0).caption+"</div>""<img src=" + vPhotoinfo.at(0).url_large + " ></img></div>";
    html +="</body>";
    this->ui->webView_right->setHtml(html);
}

void RenrenWidget::ReadPhotoShareFeed(vector<Feed_media> vfeed_media)
{
    QString id = vfeed_media.at(0).media_id;
    QString uid = vfeed_media.at(0).owner_id;
    UserInfo userinfo =this->pUserApi->getUserInfo(uid);
    vector<PhotoInfo> vPhotoinfo = this->pPhotoApi->GetPhotosFromId(id,uid);
    QString html ="<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\"><div><img src=" + userinfo.tinyurl + " width=\"50\"  height=\"50\"></img>"+ userinfo.name + ":"+vPhotoinfo.at(0).caption+"</div>""<img src=" + vPhotoinfo.at(0).url_large + " ></img></div></body>";

    this->ui->webView_right->setHtml(html);
}

void RenrenWidget::ReadPhotoAlbumShareFeed(QString aid,QString uid)
{

    vector<PhotoInfo> vPhotoinfo = this->pPhotoApi->GetPhotoAlbumFromId(aid,uid);
    UserInfo userinfo =this->pUserApi->getUserInfo(uid);
    QString html ="<body style=\"background-color:rgb(222,222,222);font-family:微软雅黑\">";
    html +="<div><img src=" + userinfo.tinyurl + " width=\"50\"  height=\"50\"></img>"+ userinfo.name + ":"+vPhotoinfo.at(0).caption+"</div>""<img src=" + vPhotoinfo.at(0).url_large + " ></img></div>";
    html +="</body>";

    this->ui->webView_right->setHtml(html);
}

QPixmap RenrenWidget::getPixmap()
{
    return httpGet.getPixMapFromUrl(QUrl(""));
}

void RenrenWidget::forward_from_otherClient(QString str)
{
    if (str.length() > 135)
    {
        str = str.left(135);
    }

    if (pStatusWidget == NULL)
    {
        pStatusWidget = new RenrenStatusWidget(this->prenrenAccount);
        QObject::connect(pStatusWidget,SIGNAL(sendStatus(QString,QString,QString,QString,QString,int)),
                         this,SLOT(StatusSlot(QString,QString,QString,QString,QString,int)));
    }
    this->pStatusWidget->setWidgetType(0);
    this->pStatusWidget->clearContent();
    this->pStatusWidget->setContent(str);
    this->pStatusWidget->show();
}

void RenrenWidget::forwardToOtherClientSlot(QString str)
{
    qDebug("in Renrenwidget forwardToOtherClientSlot");
    emit forwardToOtherClientSignal(str);
}

void RenrenWidget::changeSelectedPixmap(int index, int type)
{
    QString styleSheet="QWidget#%1%2{background-image:url(:/images/leftselected.png)}";
    if (type == 0)//remove
    {
        QString tmp = "";
        switch (index)
        {
        case 1:
            ui->left_1->setStyleSheet(tmp);
            break;
        case 2:
            ui->left_2->setStyleSheet(tmp);
            break;
        case 3:
            ui->left_3->setStyleSheet(tmp);
            break;
        case 4:
            ui->left_4->setStyleSheet(tmp);
            break;
        case 5:
            ui->left_5->setStyleSheet(tmp);
            break;
        case 6:
            ui->left_6->setStyleSheet(tmp);
            break;
        }
    }
    else if (type == 1)//add
    {
        styleSheet = styleSheet.arg("left_").arg(QString::number(index));
        switch (index)
        {
        case 1:
            ui->left_1->setStyleSheet(styleSheet);
            break;
        case 2:
            ui->left_2->setStyleSheet(styleSheet);
            break;
        case 3:
            ui->left_3->setStyleSheet(styleSheet);
            break;
        case 4:
            ui->left_4->setStyleSheet(styleSheet);
            break;
        case 5:
            ui->left_5->setStyleSheet(styleSheet);
            break;
        case 6:
            ui->left_6->setStyleSheet(styleSheet);
            break;
    }
    }
    else{
        qDebug("changeSelectedPixmap type error!!!");
    }

}

